<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>欢迎页面-WeAdmin Frame型后台管理系统-WeAdmin 1.0 生生世世</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../static/css/font.css">
		<link rel="stylesheet" href="../lib/layui/css/layui.css">
		<link rel="stylesheet" href="../static/css/weadmin.css">
		<link rel="stylesheet" href="../static/css/app.css">
		<link rel="stylesheet" href="../static/css/survey.css">
		<link rel="stylesheet" href="../static/css/index.css">
	</head>
	<body>
		<div class="weadmin-body">
			<div class="block-survey">
				<div>
					<label class="small-title" >今日概况</label>
				</div>
				<div class="survey-wrap">
					<div style="box-sizing: border-box;">
						<div class="layui-col-xs3">
							<a href="/comment/list" class="reset-color">
								<div class="item item-today">
									<div class="text-icon">
										<div class="data-number">0</div>
										<span>新评论</span>
									</div>
									<i class="icons today-comment"></i>
								</div>
							</a>
						</div>
						<div class="layui-col-xs3">
							<a href="/message/feedback" class="reset-color">
								<div class="item item-today">
									<div class="text-icon">
										<div class="data-number">0</div>
										<span>新反馈</span>
									</div>
									<i class="icons today-feedback"></i>
								</div>
							</a>
						</div>
						<div class="layui-col-xs3">
							<a href="/user" class="reset-color">
								<div class="item item-today">
									<div class="text-icon">
										<div class="data-number"><span id="newUser" class="data-number"></span></div>
										<span>新用户</span>
									</div>
									<i class="icons today-number"></i>
								</div>
							</a>
						</div>
						<div class="layui-col-xs3">
							<a href="/user" class="reset-color">
							<div class="item item-today all-leaguer">
								<div class="text-icon">
									<div class="data-number"><span id="allUser" class="data-number"></span></div>
									<span>总用户数</span>
								</div>
								<i class="icons all-leaguer"></i>
							</div>
						</a>
						</div>
					</div>
				</div>
			</div>
			<br><br><br><br><br><br><br>
			<div class="block-survey">
				<div>
					<label class="small-title">收入概要</label>
				</div>
				<div class="survey-wrap income-wrap">
					<div class="el-row">
						<div class="el-col el-col-8">
							<div class="item"><div class="text-info"><span>总收入(元)</span>
								<div class="income-number"><span id="allIncome"></span></div>
							</div>
							</div>
						</div>
						<div class="el-col el-col-8">
							<div class="item">
								<div class="text-info">
									<span>今日收入(元)</span>
									<div class="income-number"><span id="todayIncome"></span></div>
								</div>
							</div>
							</div>
						<div class="el-col el-col-8">
							<div class="item">
								<div class="text-info">
									<span>昨日收入(元)</span>
								<div class="income-number"><span id="yesterdayIncome"></span></div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="el-dialog__wrapper" before-close="function n(n){var i=arguments.length;return i?i>1?e.apply(t,arguments):e.call(t,n):e.call(t)}" style="display: none;">
					<div class="el-dialog el-dialog--small phoneBind bind" style="top: 15%;">
						<div class="el-dialog__header"><span class="el-dialog__title">绑定手机号</span>
							<div class="el-dialog__headerbtn"><i class="el-dialog__close el-icon el-icon-close"></i>
							</div>
						</div>
						<div class="el-dialog__footer">
							<span class="dialog-footer">
								<button type="button" class="el-button btn-full el-button--primary">
							<span>确 定</span></button></span></div>
					</div>
				</div>
			</div>
			<table class="layui-table" id="tableList">
				<colgroup>
					<col width="150">
					<col width="200">
					<col>
				</colgroup>
				<thead>
				<tr>
					<th>类别</th>
					<th>今日新增订单</th>
					<th>今日新增阅读量</th>
					<th>今日新增收入(元)</th>
					<th>总订单量</th>
					<th>总阅读量</th>
					<th>总收入(元)</th>
				</tr>
				</thead>
				<tbody>
				</tbody>
			</table>
		</div>
	</body>


	<script type="text/javascript"  src="../static/js/jquery.min.js" ></script>
	<script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript"  src="../static/js/admin.js" ></script>
	<script src="../static/js/republic.js" charset="utf-8"></script>
	<script type="text/javascript">
        var jsessionid= localStorage.getItem("jsessionid")

        layui.extend({
			admin: '{/}../static/js/admin',
		});
		// layui.use(['jquery', 'element','util', 'admin', 'carousel'], function() {
		// 	var element = layui.element,
		// 		$ = layui.jquery,
		// 		carousel = layui.carousel,
		// 		util = layui.util,
		// 		admin = layui.admin;
		// 	//建造实例
		// 	carousel.render({
		// 		elem: '.weadmin-shortcut'
		// 		,width: '100%' //设置容器宽度
		// 		,arrow: 'none' //始终显示箭头
		// 		,trigger: 'hover'
		// 		,autoplay:false
		// 	});
		//
		// 	carousel.render({
		// 		elem: '.weadmin-notice'
		// 		,width: '100%' //设置容器宽度
		// 		,arrow: 'none' //始终显示箭头
		// 		,trigger: 'hover'
		// 		,autoplay:true
		// 	});
		//
		// 	$(function(){
		// 		setTimeAgo(2018,0,1,13,14,0,'#firstTime');
		// 		setTimeAgo(2018,2,28,16,0,0,'#lastTime');
		// 	});
		// 	function setTimeAgo(y, M, d, H, m, s,id){
		// 	    var str = util.timeAgo(new Date(y, M||0, d||1, H||0, m||0, s||0));
		// 	    $(id).html(str);
		// 	    console.log(str);
		// 	 };
		// });



        $(function () {
            var  url = serverUrl + "/income;jsessionid="+jsessionid;
            $.ajax({
                type: "GET",
                url: url,
                xhrFields: {
                    withCredentials : true
                },
                success: function (r) {
                    if (r.code == 0) {
                        $("#allIncome").text(r.data.allIncome);
                        $("#todayIncome").text(r.data.todayIncome);
                        $("#yesterdayIncome").text(r.data.yesterdayIncome);
                        $("#newUser").text(r.data.newUser);
                        $("#allUser").text(r.data.allUser);
                        $.each(r.data.type,function (key,value) {
                            $("#tableList tbody").prepend('<tr><td>'+value.type+'</td><td>'+value.addOrder+'</td><td>'+value.addReadNum+'</td>' +
								'<td>'+value.todayMoney+'</td><td>'+value.totalOrder+'</td><td>'+value.totalReadNum+'</td><td>'+value.totalMoney+'</td></tr>');
                        });
                    } else if(r.code = 2 ){
                        layer.open({
                            // title: r.msg
                            content: r.msg
                            , btn: [' 确定'],
                            btn1: function () {
                                document.location.href = "./login.html";
                            }

                        });
                        // alert();
                    }else {
                        layer.msg(r.msg);
                    }
                },
            });
        });


	</script>

</html>